<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>WebSocket Demo</title>
    <script>
        const projectId = 'a64f5fb0-86c1-4245-b8a5-988a8fcba0c6';
        const userType = 1;
        const userId = '38af609a026077039f13d901a218d432';
        var ws = new WebSocket(`ws://localhost:8090/api/v1/ws?project-id=${projectId}&user-type=${userType}&user-id=${userId}`);

        ws.onopen = function () {
            console.log('WebSocket 连接已经建立。');
            ws.send('Hello, server!');
        };
        ws.onmessage = function (event) {
            console.log('收到服务器消息：', event.data);
        };
        ws.onerror = function (event) {
            console.error('WebSocket 连接出现错误：', event);
        };
        ws.onclose = function () {
            console.log('WebSocket 连接已经关闭。');
        };
    </script>
</head>
<body>
<h1>WebSocket Demo</h1>
</body>
</html>